﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Process.DAL;
using Process.Entities;

namespace Process.BLL
{
    public class TransactionBLL
    {
        private TransactionDAL _TransDAL = new TransactionDAL();

         public static TransactionENT GetTransactionByID(string transID)
        {
            return TransactionDAL.GetTransactionByID(transID);
        }

        public static List<TransactionENT> GetTransactionList(string partnerID, TransStatus status)
        {
            return TransactionDAL.GetTransactionList(partnerID, status);
        }

        public bool InsertTransaction(string transID, string partnerID, string productID, int minQuantity, int nextTransQuantity,
            DateTime beginTransDate, DateTime endTransDate)
        {
            TransactionENT transaction = new TransactionENT
            {
                TransID = transID,
                PartnerID = partnerID,
                ProductID = productID,
                MinQuantity = minQuantity,
                NextTransQuantity = nextTransQuantity,
                BeginTransDate = beginTransDate,
                EndTransDate = endTransDate,
                TransStatus = TransStatus.Draft.ToString()
            };
            return _TransDAL.InsertTransaction(transaction);
        }

         public bool UpdateTransactionStatus(string transID, TransStatus transStatus)
        {
            return _TransDAL.UpdateTransactionStatus(transID, transStatus);
        }
    }
}
